/***********************************************************
* Purpose : update the User Account  
* Author : NuoiNV
* Date: 19/1/2012
* Description: update the User Account 
*/
IF EXISTS ( SELECT * FROM SYSOBJECTS WHERE NAME = 'sp_UpdateUserAccount' ) 
BEGIN
	DROP PROC sp_UpdateUserAccount
END
GO
CREATE PROC sp_UpdateUserAccount

	@ID int,
	@Roles_ID int,
	@Username varchar(50),
	@Name varchar(50),
	@Phone_No int,
	@Email varchar(100),
	@Ammount float,
	@Last_Played datetime,
	@RESULT int output
AS
BEGIN
	DECLARE @Last_Update	DATETIME
	SET @Last_Update = GETDATE()
	 if exists (select * from User_Account where ID=@ID and Role_ID= @Roles_ID)
		BEGIN
			UPDATE User_Account 
			
			SET Username = @Username,[Name] = @Name , Phone_No=@Phone_No, Email = @Email , Last_Update=@Last_Update FROM User_Account where ID=@ID and Role_ID= @Roles_ID
			 SET @RESULT=1
		End
		ELSE
		Begin
			SET @RESULT =0 
		END
END